<?php

namespace App;

use Hash;
use Redis;

class PasswordVerifier
{
    public function verify($username, $password)
    {
        $uuid = Redis::hmget('email:user', $username);

        $userId = $uuid[0];

        $hashPassword = Redis::hmget("users:{$userId}", 'password');

        if (Hash::check($password, $hashPassword[0])) {
            return $userId;
        }

        return false;
    }
}